package cn.akwangl.design.pattern.structural.decorator.v2;

import org.apache.ibatis.cache.Cache;
import org.springframework.cache.transaction.TransactionAwareCacheDecorator;
import org.springframework.session.web.http.SessionRepositoryFilter;

import java.io.BufferedInputStream;
import java.io.BufferedReader;

/**
 * 装饰者模式 test.
 * <p>
 * 示例<br/>
 * {@link BufferedReader}<br/>
 * {@link BufferedInputStream}<br/>
 * {@link TransactionAwareCacheDecorator}<br/>
 * {@link SessionRepositoryFilter.SessionRepositoryRequestWrapper}<br/>
 * {@link Cache}<br/>
 * <p>
 * 装饰者模式以对客户透明的方式动态地给一个对象附加上更多的责任，装饰者模式相比生成子类可以更灵活地增加功能。
 * <p>
 * 装饰者模式的角色:<br/>
 * 1. 抽象组件类<br/>
 * 2. 具体组件类<br/>
 * 3. 装饰抽象类<br/>
 * 4. 即具体装饰者<br/>
 * </p>
 *
 * @author youyongkun
 * @date 2021/11/25 15:21
 * @since 1.0
 */
public class Test {
    public static void main(String[] args) {
        ABattercake aBattercake;
        aBattercake = new Battercake();
        aBattercake = new EggDecorator(aBattercake);
        aBattercake = new EggDecorator(aBattercake);
        aBattercake = new SausageDecorator(aBattercake);

        System.out.println(aBattercake.getDesc() + " 销售价格:" + aBattercake.cost());

    }
}
